#include<stdio.h>
#define LEN 8

int a[LEN] = {1, -2, 4, 5, 3, 2, -1, 8};

int find_least(int start, int end)
{
  if (end > start){
    int mid = start + (end - start) / 2;
    int group1 = find_least(start, mid);
    int group2 = find_least(mid + 1, end);

    return group1 < group2 ? group1 : group2;
  }
  else{
    return a[start];
  }
}

int find_second_smallest(int start, int end)
{
  int least = find_least(start, end);
  int tmp[LEN];

  int n = 0, i = 0;
  for (i = start; i <= end; ++i){
    if (a[i] !=  least){
      tmp[n++] = a[i];
    }
  }

  int ret = tmp[0];

  for (i = 1; i < n; ++i){
    if (tmp[i] < ret)
      ret = tmp[i];
  }

  return ret;
}

int main()
{
  printf("%d\n", find_second_smallest(0, 7));
  return 0;
}
